package com.jinke.uang.base;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

import com.jinke.uang.interfaces.ICommonModule;
import com.jinke.uang.interfaces.ICommonView;

public abstract class BaseNormalActivity <P extends BasePersenter,M>extends BaseNetActivity implements ICommonView {
    public P mPresenter;
    public M mModule;

    @Override
    protected void init(Bundle savedInstanceState) {
        super.init(savedInstanceState);
        mPresenter = getPresenter();
        mModule=getModule();
        if(mPresenter!=null && mModule!=null) mPresenter.attach((ICommonModule)mModule,this);
    }

    protected abstract P getPresenter();
    protected abstract M getModule();

    /**
     * 隐藏键盘
     */
    protected void hideSoftPan(View v) {
        InputMethodManager imm = (InputMethodManager)
                getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
    }
}
